<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="../css/iconfont.css" />
		<link rel="stylesheet" href="../css/style.css" />
		<style>
			[v-cloak] {
				display: none;
			}
			
			html,
			body {
				height: 100%;
			}
			
			.mui-bar-nav {
				background: #f16456;
				height: 58px;
			}
			
			.mui-bar .mui-title {
				margin-top: 18px;
			}
			
			.mui-bar-nav~.mui-content {
				padding-top: 58px;
			}
			
			.mui-action-back,
			.mui-title,
			.mui-action-back:active,
			.mui-btn-link {
				color: #FFFFFF!important;
				margin-top: 17px;
			}
			
			.mui-content {
				background-image: url(../images/homeBg.png);
				background-repeat: no-repeat;
				background-size: cover;
				min-height: 100%;
			}
			
			.mui-row .mui-col-xs-6 {
				margin-top: 10px;
			}
			
			.mui-row .mui-col-xs-6 img {
				border-radius: 10px;
				max-width: 235px;
			}
			
			.mui-row .mui-col-xs-6 .room-info {
				position: absolute;
				left: 9%;
				color: white;
				top: 5%;
				text-align: -webkit-center;
			}
			
			.room-info .title {
				margin-top: 5%;
			}
			
			.room-info .block {
				margin: 5px 20px 0px;
				font-size: 13px;
				border-radius: 15px;
				background-color: #f16456;
			}
			
			.mt50 {
				margin-top: 50%!important;
			}
			
			.noroom {
				margin: auto;
				padding: 0px;
				top: 0;
				left: 0;
				right: 0;
				bottom: 0;
				height: 20px;
				width: 100px;
				color: #f16456;
				position: absolute;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title" id="title">我的房间</h1>
		</header>
		<div class="mui-content" id="bizVue" v-cloak>
			<div class="mui-row">
				<div class="mui-col-xs-6 mui-text-center" v-for="item in rooms" @click="gotoRoom(item)">
					<img src="../images/room.jpg" class="mui-col-xs-10" />
					<div class="mui-col-xs-10 mui-text-center room-info">
						<div class="title">{{item.roomName}}</div>
						<div class="block mt50">金币:{{item.vipMinAmount}}-{{item.vipMaxAmount}}</div>
						<div class="block">人数上限:{{item.personLimit}}</div>
						<div class="block">{{item.vipExpireTime.substr(0,10)}}过期</div>
					</div>
				</div>
				<div class="noroom" v-if="rooms != null && rooms.length == 0">
					<h3>您还没有创建房间</h3>
				</div>
			</div>
		</div>
		<script type="text/javascript" src="../js/mui.min.js"></script>
		<script type="text/javascript" src="../js/vue.min.js"></script>
		<script type="text/javascript" src="../js/public.js"></script>
		<script type="text/javascript">
			var vm = new Vue({
				el: '#bizVue',
				data: {
					rooms: null
				},
				mounted: function() {
					mui.plusReady(function() {
						swipeBack();
						mui.postParam(MyRoomList, null, function(result) {
							if(result.code == 0) {
								vm.rooms = result.rooms;
							} else {
								mymui(result.msg);
							}
						});
					});
				},
				methods: {
					gotoRoom: function(item) {
						mui.fire(plus.webview.getWebviewById('home.html'), 'setMusic', {
							type: "btn"
						});
						mui.postParam(GotoMyRoom, {
							roomId: item.id
						}, function(result) {
							if(result.code == 0) {
								mui.openWindow({
									id: "room",
									url: "../main/room.html",
									extras: {
										center: result.center,
										room: item
									},
									waiting: {
										autoShow: false
									}
								});
							} else {
								mymui(result.msg);
							}
						});

					}
				}
			});
		</script>
	</body>

</html>